package com.gitee.cirnochat.file.model.vo.resp;

import com.gitee.cirnochat.file.model.entity.EmojiPackItemDetail;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.time.ZoneOffset;

/**
 * 表情包项表
 */
@Schema(description = "表情包项响应对象")
@Data
@NoArgsConstructor
public class EmojiPackItemResponse implements Serializable {
    /**
     * 主键ID
     */
    @Schema(description = "项ID")
    private Long id;

    /**
     * 图片url
     */
    @Schema(description = "图片url")
    private String fileUrl;

    /**
     * 图片文件ID
     */
    @Schema(description = "图片文件ID")
    private Long fileId;

    /**
     * 排序
     */
    @Schema(description = "排序")
    private Integer sortOrder;

    /**
     * 创建时间
     */
    @Schema(description = "创建时间")
    private Long createTime;

    /**
     * 更新时间
     */
    @Schema(description = "更新时间")
    private Long updateTime;

    public EmojiPackItemResponse(EmojiPackItemDetail item) {
        BeanUtils.copyProperties(item, this);
        this.createTime = item.getCreateTime().toEpochSecond(ZoneOffset.UTC);
        this.updateTime = item.getUpdateTime().toEpochSecond(ZoneOffset.UTC);
    }
}